//
//  Match.m
//  Full_House
//
//  Created by 张忱 on 15-6-3.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "Match.h"

@implementation Match

- (void)dealloc{
    [_phone release];
    [_userImage release];
    [_province release];
    [_realName release];
    [_city release];
    [_myId release];
    [_image release];
    [_userName release];
  
    [super dealloc];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if ([key isEqualToString:@"user"]) {
        self.userImage = [[value objectForKey:@"userImage"]objectForKey:@"medium"];
        self.phone = [value objectForKey:@"phone"];
        self.province = [value objectForKey:@"province"];
        self.realName = [value objectForKey:@"realName"];
        self.city = [value objectForKey:@"city"];
        self.userName = [value objectForKey:@"userName"];
    }
    
       if ([key isEqualToString:@"tags"]) {
        self.image = [[value firstObject] objectForKey:@"image"];
       }if ([key isEqualToString:@"id"]) {
           self.myId = [value description];
       }
    
}
+ (NSMutableArray *)matchArrWithDic:(NSMutableArray *)dicArr{
    NSMutableArray *matchArr = [NSMutableArray array];
    for (NSDictionary *dic in dicArr) {
        Match *match = [[Match alloc] init];
        [match setValuesForKeysWithDictionary:dic];
        [matchArr addObject:match];
    }
    return matchArr;
}

@end
